package com.beself.service.impl;

import com.beself.dao.TChallengeMapper;
import com.beself.service.ChallengeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @ProjectName: beself
 * @Package: com.beself.service.impl
 * @ClassName: ChallengeServiceImpl
 * @Description: java类作用描述
 * @Author: 樊晋源
 * @CreateDate: 2019/10/18 19:59
 * @Version: 1.0
 */
@Service
public class ChallengeServiceImpl implements ChallengeService {
    @Resource
    private TChallengeMapper tChallengeMapper;
    @Override
    public int insertone(int uId,int routeId, int taskId, int ci) {
        Map map = new HashMap();
        map.put("uId",uId);
        map.put("taskId",taskId);
        map.put("routeId",routeId);
        map.put("ci",ci);
        int i = tChallengeMapper.insertone(map);

        return i;
    }

    @Override
    public int selectlastdate(int uId,int routeId, int taskId) {
        Map map = new HashMap();
        map.put("uId",uId);
        map.put("taskId",taskId);
        map.put("routeId",routeId);
        return tChallengeMapper.selectlastdate(map);
    }

    @Override
    public int updateone(int uId,int routeId,int taskId,int ci) {
        Map map = new HashMap();
        map.put("uId",uId);
        map.put("taskId",taskId);
        map.put("routeId",routeId);
        map.put("ci",ci);
        return tChallengeMapper.updateone(map);
    }

    @Override
    public int updatestate(int uId,int routeId,int taskId) {
        Map map = new HashMap();
        map.put("uId",uId);
        map.put("taskId",taskId);
        map.put("routeId",routeId);
        return tChallengeMapper.updatestate(map);
    }
}
